package com.piao.adapter;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.piao.R;
import com.piao.bean.Movies;
import com.piao.manager.ImageLoader;

import java.util.List;

/**
 * Created by guoliangli on 2017/4/11.
 */

public class HomeFindAdapter extends RecyclerView.Adapter<HomeFindAdapter.MoviesHolder> {

    private Context context;
    private ImageLoader imageLoader;
    private int[] list = {R.drawable.baoli,R.drawable.jinyi,R.drawable.wanda,R.drawable.nuomi,R.drawable.taobao,R.drawable.maoyan};

    public HomeFindAdapter(Context context) {
        this.context=context;
        imageLoader=new ImageLoader(context);
    }

    @Override
    public MoviesHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        int resId = R.layout.piao_grid_item;
        View view = LayoutInflater.from(context).inflate(resId, parent, false);
        MoviesHolder holder = new MoviesHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(MoviesHolder holder, int position) {
        holder.movie_icon.setImageResource(list[position]);
    }

    @Override
    public int getItemCount() {
        return list.length;
    }


    class MoviesHolder extends RecyclerView.ViewHolder{



        public ImageView movie_icon;

        public MoviesHolder(View itemView) {
            super(itemView);
            movie_icon = (ImageView) itemView.findViewById(R.id.movie_icon);
        }
    }
}
